using System.Collections.Generic;
using System.Xml;
using ConfigManager.Core.Instructions;
using NUnit.Framework;

namespace ConfigManager.Tests.Instructions
{
    [TestFixture()]
    public class ExternalSectionTests
    {
        /// <summary>
        ///A test for Run
        ///</summary>
        [Test()]
        public void EmbedExternalFile()
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(@"instructions\ExternalSection1.xml");
            XmlNode node = xmlDoc.SelectNodes("//comment()")[0];
            IDictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("source", @"instructions\ExternalSectionFragment.xml");

            string data = string.Empty;
            ExternalSectionInstruction target = new ExternalSectionInstruction(xmlDoc, node, parameters);
            target.Run();

            Assert.IsNotNull(xmlDoc.SelectSingleNode("/root/external/externalNode"));
        }
    }
}
